
foreach year of numlist 2010/2019 {
 
	import spss using  "${endesData}/endes`year'/RE516171.sav", clear
	ren * , upper
	tempfile merged
	sa `merged'
	
	import spss using  "${endesData}/endes`year'/REC84DV.sav", clear
	ren * , upper
	merge 1:1 CASEID using `merged', nogen
	
	gen year = `year'
	sa "$data_folder/endes_`year'.dta", replace
}


use "$data_folder/endes_2010.dta", clear


foreach year of numlist 2011/2019 {
	
	append using "$data_folder/endes_`year'.dta"

}


sa "$data_folder/endes_stacked.dta", replace
